package Command;

public class RightControl {
    private Command command;

    public void setCommand(Command command) {
        this.command = command;
    }
    
    public void buttonWasPress() {
        command.execute();
    };
    
    public static void main(String[] args) {
        Light light = new Light();
        LightOnCommand lightOnCommand = new LightOnCommand(light);
        LightOffCommand lightOffCommand = new LightOffCommand(light);
        RightControl rightControl = new RightControl();
        rightControl.setCommand(lightOnCommand);
        rightControl.buttonWasPress();
        rightControl.setCommand(lightOffCommand);
        rightControl.buttonWasPress();
    }
}
